home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Projects / Planet_Potter / progress / Planet Potter 3.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  2.9 KB  |  136 lines

  1. Rem Project: Planet Potter
  2. Rem Created: 25/07/2002 15:38:30
  3.  
  4. rem Initialise
  5. sync on : sync rate 60
  6. set text font "Arial" : set text size 20
  7. set text to bold : set text transparent
  8.  
  9. rem Load environment
  10. load object "media\moonlit\ml.x",100
  11. scale object 100,20,20,20
  12. set object cull 100,0
  13. set object light 100,0
  14. set object texture 100,2,1
  15.  
  16. rem Load nine planets
  17. for p=1 to 9
  18.  load object "media\planet\planet.x",p
  19.  position object p,(p-3)*350,0,500
  20.  hide object p
  21. next p
  22.  
  23. rem Load tenth planet for home
  24. load object "media\planet\planet.x",10
  25. position object 10,0,-150,-350
  26. rotate object 10,0,0,90
  27.  
  28. rem Load particle image
  29. load image "media\gfx\fire.bmp",1
  30.  
  31. rem Load player sounds
  32. load sound "media\sounds\shoot.wav",1
  33.  
  34. rem Load game sounds
  35. load sound "media\sounds\appear.wav",11
  36. for s=12 to 19 : clone sound s,11 : next s
  37. load sound "media\sounds\explode.wav",21
  38. for s=22 to 29 : clone sound s,21 : next s
  39.  
  40. rem Setup camera and light
  41. set camera range 0.1,3000
  42. set point light 0,-50,80,-600
  43. set light range 0,2000
  44.  
  45. rem Starting rate
  46. prate=150
  47.  
  48. rem Game loop
  49. do
  50.  
  51. rem Control player cursor and shot
  52. if mouseclick()=1 and guncool=-1
  53.  rem Shoot effect
  54.  play sound 1 : guncool=3
  55.  rem Detect good hit
  56.  for p=1 to 9
  57.   if object visible(p)=1 and object angle z(p)=0
  58.    sx=object screen x(p)
  59.    sy=object screen y(p)
  60.    mx=mousex() : my=mousey()
  61.    if mx>sx-100 and mx<sx+100 and my>sy-100 and my<sy+100
  62.     zrotate object p,1
  63.     play sound 20+p
  64.    endif
  65.   endif
  66.  next p
  67. endif
  68. if guncool=0 and mouseclick()=0 then guncool=-1
  69. if guncool>0 then dec guncool
  70.  
  71. rem Control planets
  72. gosub _newplanets
  73. gosub _moveplanets
  74.  
  75. rem Rotate sky backdrop and home planet
  76. yrotate object 100,wrapvalue(object angle y(100)+0.1)
  77. yrotate object 10,wrapvalue(object angle y(10)-0.05)
  78.  
  79. rem Stats
  80. inc points
  81. prompt$="SCORE: "+str$(points)
  82. center text screen width()-text width(prompt$),screen height()-40,prompt$
  83.  
  84. rem Update screen
  85. sync
  86.  
  87. rem End loop
  88. loop
  89. end
  90.  
  91. _newplanets:
  92.  
  93. if pmaker>0 then dec pmaker
  94. if pmaker=0
  95.  p=1 : while object visible(p)=1 and p<9 : inc p : endwhile
  96.  x=rnd(2000)-1000
  97.  y=rnd(1500)-500
  98.  position object p,x,y,1000
  99.  scale object p,100,100,100
  100.  rotate object p,0,0,0
  101.  ghost object off p
  102.  play sound 10+p
  103.  show object p
  104.  pmaker=prate+rnd(prate/2)
  105.  if prate>30 then dec prate,20
  106. endif
  107.  
  108. return
  109.  
  110. _moveplanets:
  111.  
  112. rem Move all planets
  113. for p=1 to 9
  114.  position object p,object position x(p)/1.01,object position y(p)/1.01,object position z(p)-10
  115.  yrotate object p,wrapvalue(object angle y(p)+1)
  116.  if object position z(p)<-600 then hide object p
  117. next p
  118.  
  119. rem Handle planet destruction
  120. for p=1 to 9
  121.  if object angle z(p)>0 and object visible(p)=1
  122.   s=50-object angle z(p)
  123.   ghost object on p,2
  124.   scale object p,s*2,s*2,s*2
  125.   zrotate object p,object angle z(p)+1
  126.   if object angle z(p)>70
  127.    hide object p
  128.   endif
  129.  endif
  130. next p
  131.  
  132. return
  133.  
  134.  
  135.  
  136.